package com.base.cn.platform.os.service.course.classes;

import com.base.cn.platform.os.entity.classes.Classes;
import com.base.cn.platform.os.entity.course.cou.Course;
import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.course.CourseBaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 班级
 *
 * @author SK
 * @since 2018-05-08
 */
@FeignClient(value = CourseBaseService.appName, configuration = FeignAuthConfig.class)
public interface ClassesService extends CourseBaseService {

    /**
     * 获取班级数量
     * @param classes 查询条件
     * @return BigDecimal数量
     */
    @RequestMapping(contextPath + "/getClassCount")
    BigDecimal getClassCount(@RequestBody Map<String, Object> classes);

    /**
     * 查询课程下的班级
     * @param courseId 课程ID
     * @return 班级列表
     */
    @RequestMapping(contextPath + "/findCourseToClassesList")
    List<Map<String,Object>> findCourseToClassesList(@RequestParam("courseId") BigDecimal courseId);

    /**
     * 根据id查询班级
     *
     * @param id         试题id
     * @param setSubject 设置专业
     * @param setCreator 设置创建人
     * @param setCourse  设置课程
     * @param setMember  设置成员
     * @param order      排序 1.班主任 -> 普通学员
     * @param identity   1.普通学员 2.班级管理员 3.班主任
     * @return 班级
     */
    @RequestMapping(contextPath + "/findClassesById")
    Map<String, Object> findClassesById(@RequestParam("id") BigDecimal id,
                                        @RequestParam("setSubject") boolean setSubject,
                                        @RequestParam("setCreator") boolean setCreator,
                                        @RequestParam("setCourse") boolean setCourse,
                                        @RequestParam("setMember") boolean setMember,
                                        @RequestParam(value = "order", required = false) Integer order,
                                        @RequestParam("identity") Integer... identity);

    /**
     * 根据id查询班级
     *
     * @param ids        班级id
     * @param setSubject 设置专业
     * @param setCreator 设置创建人
     * @return 班级 key:班级id value:班级
     */
    @RequestMapping(contextPath + "/findClassesByIds")
    Map<BigDecimal, Map<String, Object>> findClassesByIds(@RequestParam("ids") String ids,
                                                          @RequestParam("setSubject") boolean setSubject,
                                                          @RequestParam("setCreator") boolean setCreator);

    /**
     * 查询班级列表
     *
     * @param classes     班级查询条件
     * @param currentPage 当前页
     * @param pageSize    每页数据量
     * @param setSubject  设置专业
     * @param setCreator  设置创建人
     * @param setCourse   设置课程
     * @param setMember   设置成员
     * @param identity    1.普通学员 2.班级管理员 3.班主任
     * @return 班级列表
     */
    @RequestMapping(contextPath + "/findClassesListPage")
    Map<String, Object> findClassesListPage(@RequestBody Map<String, Object> classes,
                                            @RequestParam("currentPage") int currentPage,
                                            @RequestParam(value = "pageSize", required = false) Integer pageSize,
                                            @RequestParam("setSubject") boolean setSubject,
                                            @RequestParam("setCreator") boolean setCreator,
                                            @RequestParam("setCourse") boolean setCourse,
                                            @RequestParam("setMember") boolean setMember,
                                            @RequestParam("identity") Integer... identity);

    /**
     * 查询个人班级列表
     *
     * @param cusUserId   前台用户id
     * @param currentPage 当前页
     * @param pageSize    每页数据条数
     * @return 班级列表
     */
    @RequestMapping(contextPath + "/findClassesPersonalListPage")
    Map<String, Object> findClassesPersonalListPage(@RequestParam("cusUserId") BigDecimal cusUserId,
                                                    @RequestParam("currentPage") int currentPage,
                                                    @RequestParam(value = "pageSize", required = false) Integer pageSize);

    /**
     * 保存班级
     *
     * @param classes 班级
     * @return 保存结果
     */
    @RequestMapping(contextPath + "/saveClasses")
    Map<String, Object> saveClasses(@RequestBody Map<String, Object> classes);

    /**
     * 更新班级状态
     *
     * @param ids    班级id
     * @param status 班级状态 1.正常 2.停班
     * @return 操作结果
     */
    @RequestMapping(contextPath + "/updateClassesStatus")
    Map<String, Object> updateClassesStatus(@RequestParam("ids") String ids,
                                            @RequestParam("status") int status);

    /**
     * 班级话题分类统计数量
     *
     * @param classesId 班级id
     * @return 班级话题分类统计数量
     */
    @RequestMapping(contextPath + "/classesTopicStatistics")
    Map<String, Object> classesTopicStatistics(@RequestParam(value = "classesId", required = false) BigDecimal classesId,
                                               @RequestParam(value = "userId", required = false) BigDecimal userId);


    /**
     * 查询个人班级列表 不分页
     *
     * @param cusUserId   前台用户id
     * @return 班级列表
     */
    @RequestMapping(contextPath + "/findClassesPersonalList")
    List<Map<String, Object>> findClassesPersonalList(@RequestParam("cusUserId") BigDecimal cusUserId);


    /**
     * 更新班级封面
     *
     * @param classes 班级
     * @return 保存结果
     */
    @RequestMapping(contextPath + "/saveClassesImg")
    Map<String, Object> saveClassesImg(@RequestBody Map<String, Object> classes);


    /**
     * 获取课程关联班级
     *
     * @param courseId 班级id
     * @return
     */
    @RequestMapping(contextPath + "/getCourseRelevanceClasses")
    List<Map> getCourseRelevanceClasses(@RequestParam(value = "courseId") BigDecimal courseId);

    /**
     * 保存班级
     *
     * @param classes 班级
     * @return 保存结果
     */
    @RequestMapping(contextPath + "/editBrief")
    Map<String, Object> editBrief(@RequestBody Map<String, Object> classes);

}
